package com.hschinese.pronunciation.widget;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.hschinese.pronunciation.R;


public class HsDialog extends Dialog {
	@SuppressWarnings("unused")
	private Context ctx;
	private String content;

	public HsDialog(Context context, int theme, String content, boolean cancelable, boolean outside) {
		super(context,theme);
		this.ctx = context;
		this.content = content;
		setCancelable(cancelable);
		setCanceledOnTouchOutside(outside);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_loading_dialog);
		((TextView)(findViewById(R.id.dialog_title))).setText(content);

		if(TextUtils.isEmpty(content)){
			findViewById(R.id.dialog_title).setVisibility(View.GONE);
		}else{
			findViewById(R.id.dialog_title).setVisibility(View.VISIBLE);
			((TextView)(findViewById(R.id.dialog_title))).setText(content);
		}
	}
}
